package pack;

public class nod
{
	public static void main(String[] args)
	{
		int a = 300000;
		int b = 1701;
		long start;
		start = System.nanoTime();
        System.out.println("Nod: " + nod(a, b));
        System.out.println("Time of running: "+(System.nanoTime()-start)+" nanosec");

		start = System.nanoTime();
        System.out.println("Evclid: " + evclid(a, b));
        System.out.println("Time of running: "+(System.nanoTime()-start)+" nanosec");
	}
	
	public static int nod(int a, int b)
	{
        if (b == 0) return a;
        int x = a % b;
        return nod(b, x);
    }
	
    public static int evclid(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }
}
